﻿using System;
using System.IO;

namespace PPIDesktopClient.General
{
    public static class ErrorManager
    {
        public static void Log(string exceptionName, string classError, string message, string stackTrace)
        {
            DirHelper.isDirectory(Constants.K_ErrorPath);
            StreamWriter _a = File.AppendText(Constants.K_ErrorPath + "DebugClasses.txt");
            _a.WriteLine("Error Log:");
            _a.WriteLine(System.DateTime.Now.ToShortDateString() + " " + System.DateTime.Now.ToShortTimeString());
            _a.WriteLine("Exception Name:");
            _a.WriteLine(exceptionName);
            _a.WriteLine("Class Error:");
            _a.WriteLine(classError);
            _a.WriteLine("Message:");
            _a.WriteLine(message);
            _a.WriteLine("Stack Trace:");
            _a.WriteLine(stackTrace);
            _a.Close();
            _a.Dispose();
        }
    }
}
